package com.jia.train.seat.controller;

import com.jia.train.global.page.PageResponse;
import com.jia.train.global.response.BaseResponse;
import com.jia.train.seat.request.DailyTrainTicketQueryRequest;
import com.jia.train.seat.response.DailyTrainTicketQueryResponse;
import com.jia.train.seat.service.DailyTrainTicketService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/daily/ticket")
public class DailyTrainTicketController {

    @Resource
    private DailyTrainTicketService dailyTrainTicketService;

    @GetMapping("/query")
    public BaseResponse<PageResponse<DailyTrainTicketQueryResponse>> query(@Valid DailyTrainTicketQueryRequest request) {
        PageResponse<DailyTrainTicketQueryResponse> responseList = dailyTrainTicketService.selectPage(request);
        return new BaseResponse<>(responseList);
    }

    @DeleteMapping("/delete")
    public BaseResponse<String> delete() {
        dailyTrainTicketService.deleteTicket();
        return new BaseResponse<>("success");
    }

}
